<template>
  <el-config-provider :locale="locale">
    <div class="container">
      <el-button @click="changeLang('zh')">中文</el-button>
      <el-button @click="changeLang('en')">English</el-button>
      <h1>Datax Job Generator</h1>
      <Form />
    </div>
  </el-config-provider>
</template>

<script setup>
import { ElMessageBox, ElMessage } from 'element-plus'
import Form from './components/Form.vue'
import { ElConfigProvider } from 'element-plus'

import zhCn from 'element-plus/lib/locale/lang/zh-cn'
import en from 'element-plus/lib/locale/lang/en'

import { getCurrentInstance } from "vue";

import { ref } from "vue";

const locale = ref(zhCn)

const { proxy } = getCurrentInstance();

const changeLang = (type) => {
  proxy.$i18n.locale = type;
  if (type === 'zh') {
    locale.value = zhCn
  } else {
    locale.value = en
  }

}
</script>

<style>
html,
body {
  margin: 0;
  padding: 0;

  background-color: #f1f1f1;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
.container {
  width: 600px;
  margin: 0 auto;
  background-color: #fff;
  padding: 20px;
}
</style>
